package com.jz.netthings.application.providerCollection.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jz.netthings.application.providerCollection.bean.InputResource;
import com.jz.netthings.application.providerCollection.bean.MutualCheck;
import com.jz.netthings.application.providerCollection.service.InputResourceService;
import com.jz.netthings.application.providerCollection.service.MutualCheckService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 采浆记录-互检 前端控制器
 * </p>
 *
 * @author zyl
 * @since 2019-03-25
 */
@RestController
@RequestMapping("/adscm/application/providerCollection/select/mutualCheck")
public class MutualCheckController {
    @Autowired
    MutualCheckService mutualCheckService;
    @RequestMapping("/selectMutualCheck")
    public SimpleCoreResponse selectMutualCheck( String mlogId , HttpServletRequest request) throws AdscmSystemException, IOException {
        Wrapper<MutualCheck> wrapper =new EntityWrapper<>();
        wrapper.like("mlogId", mlogId);
        List<MutualCheck> mutualChecks = mutualCheckService.selectList(wrapper);
        MutualCheck mutualCheck =new MutualCheck();
        if (mutualChecks!=null && mutualChecks.size()>0){
            mutualCheck=mutualChecks.get(0);
        }
        return new SimpleCoreResponse("200","查询成功" ,mutualCheck);
    }
}

